home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2972 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  973 b 

  1. Path: news.uh.edu!usenet
  2. From: Sensarn <txs53132@bayou.uh.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Help -- File Input
  5. Date: 21 Jan 1996 04:15:02 GMT
  6. Organization: AEtna Insurance Agency
  7. Message-ID: <4dsek6$m0k@masala.cc.uh.edu>
  8. NNTP-Posting-Host: sip-14278.public-dialups.uh.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
  13.  
  14.      I am trying to write a function that reads integers from a file.  I 
  15. tried this:
  16.  
  17. unsigned int fgetint(FILE *fp)
  18. {
  19.     unsigned char al,ah; //Bytes in my make-believe AX register
  20.     al=(unsigned char)fgetc(fp); //Low byte
  21.     ah=(unsigned char)fgetc(fp); //High byte
  22.     return(ah<<8+al); //Return high byte over low byte
  23. }
  24.  
  25. TC++ tells me I cant start a function declaration with FILE.  The 
  26. prototype for the fgetc function uses it (by the way -- I #included the 
  27. appropriate header files).  How can I do this?
  28.  
  29. Steven Sensarn - txs53132@bayou.uh.edu
  30.  
  31.